import { asyncRoutes } from '@/router'
export default {
  namespaced: true,
  state: {
    routes: []
  },
  mutations: {
    setRouter(state, routes) {
      state.routes = routes
    }
  },
  actions: {
    generateRoutes({ commit }, menus) {
      const routes = []
      menus.forEach(item => {
        routes.push(...asyncRoutes.filter(route => route.path.includes(item)))
      })
      commit('setRouter', routes)
      return routes
    }
  }

}
